package com.atguigu.eud_teacher.feignclient;

import com.atguigu.commonutils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @description:
 * @author: Administrator
 * @date: 2021-04-08 14:25
 */
@Component
//在网络请求时，可能会出现异常请求，如果还想再异常情况下使系统
// 可用，那么就需要容错处理，比如:网络请求超时时给用户提示“稍后重试”或使用本地快照数据等等
@FeignClient(name="service-video",fallback = CourseFeignVideoImpl.class)
//@FeignClient("service-video")
public interface CourseFeignVideo {
    //单个删除
    @DeleteMapping("/edu_subject/video/deleteVideos/{id}")
    //这里value="id"定义规则，因为feign调用是用http请求方式，这里要定义
    public R deleteVideo(@PathVariable(value="id") String id);

    //批量删除
    @DeleteMapping("/edu_subject/video/deleteForBatch")
    public R deleteForBatch(@RequestParam("videoIdList") List<String> videoIdList);

    @GetMapping("/edu_subject/video/getPlayAuth/{videoSourceId}")
    public R getVideoPlayAuth(@PathVariable(value="videoSourceId") String videoSourceId);
}